package com.yjn.redisdemo.service;

import com.yjn.redisdemo.dao.BookDao;
import com.yjn.redisdemo.entity.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

@Service
public class BookService {
    @Autowired
    private BookDao bookDao;

    public String getValue(String key){
        return bookDao.getVue(key);
    }

    public void setValue(String key,String value){
        bookDao.setVue(key,value);
    }

    public List<Book> findBooks(String id){
        return bookDao.findBook(id);
    }

    public void saveBooks(Object key, List<Book> books){
        bookDao.saveBooks(key, books);
    }

    public Book findBookById(int id){
        return bookDao.findBookById(id);
    }

    public void saveBook(Book book){
        bookDao.saveBook(book);
    }

    public void deleteBook(int id){
        bookDao.deleteBook(id);
    }
}
